<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@page import="com.zmht.specedu.vo.Fengongtype,com.zmht.specedu.vo.Teacher,com.zmht.specedu.senate.web.form.TeacherForm"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%
	/**
	 * @author 张天兴
	 * @since 2009/05/08
	 */

 %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<meta http-equiv="Content-Type" content="text/html; charset=gb18030" />
<title>聋校备课与语言学习及矫治系统</title>
<link href="<%=request.getContextPath() %>/reference/datePicker/skin/WdatePicker.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="<%=request.getContextPath() %>/reference/js/jquery.js"></script>
<script src="<%=request.getContextPath() %>/reference/WebCalendar.js" type="text/javascript"></script>

<fmt:setBundle basename="PathResource" scope="session" />
<link href="<%=request.getContextPath()%>/<fmt:message key='StylePath' />style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript"
	src="<fmt:message key='datePicker' />WdatePicker.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/<fmt:message key='jquery' />jquery.js"></script>

<script src="<%=request.getContextPath()%>/<fmt:message key='JavaScriptPath' />validate.js" type="text/javascript"></script>

<script type="text/javascript">

 function check(obj){          
            if(document.forms[0].tname.value==""){
				alert("请输入教师姓名！");
				document.forms[0].tname.focus();
				return false;
			}
			 var var1=document.forms[0].tname.value;
			 var parten = /^\s*$/ ;
			 if(parten.test(var1)){
				alert("输入的教师姓名不正确！");
				document.forms[0].tname.focus();
				return false;
			}
			if(document.forms[0].tbirthday.value==""){
				alert("请输入出生日期!");
				document.forms[0].tbirthday.focus();
				return false;
			}
						
			if(document.forms[0].workTime.value==""){
				alert("请输入工作时间,必须是正整数1-99！！");
				document.forms[0].workTime.focus();
				return false;
			}			 
			  var regw =  /^\+?[1-9][0-9]*$/;　　//正整数 
			  var workTime=document.forms[0].workTime.value;
	            if(!regw.test(workTime) || workTime>99){
	             alert("工作时间格式不正确，必须是1-99之间的一个值!");
	             return false;
	             }		
	           var teachProcess=document.forms[0].teachProcess.value;  
			 if(teachProcess.length>200){
	             alert("教学经历格式不正确,只允许200字以内!");
	             return false;
	             }		       
			   var rongYu=document.forms[0].rongYu.value;  
			 if(rongYu.length>200){
	             alert("曾获荣誉格式不正确,只允许200字以内!");
	             return false;
	             }		               
			
			if(document.forms[0].tuserName.value==""){
			    alert("请输入登陆用户名,必须是4-10位的字母,数字！");
				document.forms[0].tuserName.focus();
				return false;
			}
			var reg = /^([a-zA-Z]|\d)*$/;
			var tuserName=document.forms[0].tuserName.value;
            if(!reg.test(tuserName) || tuserName.length<4){
            	alert("用户名格式不正确,只允许4-10位字母、数字组成");
             	return false;
            }		         			
			    		    
			
			if(document.forms[0].tpassWord.value==""){
				alert("请输入密码必须是4-15位的字母,数字,下划线！");
				document.forms[0].tpassWord.focus();
				return false;
			}
			var regt = /^([a-zA-Z]|\d|_)*$/;
			var tpassWord=document.forms[0].tpassWord.value;
	        if(!regt.test(tpassWord) || tpassWord.length<4){
	             alert("密码格式不正确,只允许4-15位字母，数字或下划线组成");
	             return false;
	        }		
	               
			if(document.forms[0].cpassWord.value==""){
				alert("请输入确认密码,必须是4-15位的字母,数字,下划线！");
				document.forms[0].cpassWord.focus();
				return false;
			}
		    var regc = /^([a-zA-Z]|\d|_)*$/;
		    var cpassWord=document.forms[0].cpassWord.value;
	            if(!regc.test(cpassWord) || cpassWord.length<4){
	             alert("确认密码格式不正确,必须是4-15位的字母，数字或下划线组成!");
	             return false;
	               }	              
			  
			  var tpassWordValue = document.forms[0].tpassWord.value;
			  var cpassWordValue = document.forms[0].cpassWord.value;
           if(tpassWordValue!=cpassWordValue){
               alert("两次输入的密码不一致!!");
               return false;
           }  
			
  
      //document.forms[0].submit();
  
     return Validator.Validate(obj,3);
  
 	} 
	function checkUserName(inpt){
		if(inpt.value==""){
		    addErrorTOUserNameSpan("请输入登陆用户名,必须是4-10位的字母,数字！")
			
			return;
		}
		var reg = /^([a-zA-Z]|\d)*$/;
		var tuserName=inpt.value;
        if(!reg.test(tuserName) || tuserName.length<4){
        	addErrorTOUserNameSpan("用户名格式不正确,只允许4-10位字母、数字组成");
         	return;
        }
        
		var url = "<%=request.getContextPath()%>/teacherAction.do?method=checkUserNameOnlyForAjax";
		$.ajax({
			 url: url,
			 type: 'POST',
			 dataType: 'text',
			 timeout: 20000,//超时时间设定
			 data:'userName='+inpt.value,//参数设置
			 error: function(){alert('error');},//错误处理，隐藏进度条
			 success: function(text){
				 if(text=="false"){
					 addErrorTOUserNameSpan("用户名已被使用！");
				 }else{
					 addErrorTOUserNameSpan("");
				 }
			 }
		});
	}
	function addErrorTOUserNameSpan(text){
		$("#userNameSpan").html("*" + text);
		if(text!=""){
			document.forms[0].tuserName.focus();
			document.forms[0].tuserName.select();
		}
	}
</script>
</head>
<body class="bcolor">
<form name="teacherForm" action="teacherAction.do" method="post" onsubmit="return check(this);">
 <input type=hidden name="method" value="save" />
  <table cellspacing="0" cellpadding="0" width="99%" align="center" border="0">
    <tbody>
      <tr>
        <td width="7"><img height="38" alt="" src="<%=request.getContextPath()%>/<fmt:message key='CommonImagePath' />table_1_01.gif"  width="7" /></td>
        <td background="<%=request.getContextPath()%>/<fmt:message key='CommonImagePath' />table_1_05.gif"><table cellspacing="0" cellpadding="0" width="100%" border="0">
            <tbody>
              <tr>
                <td width="30"><img height="38" alt="" src="<%=request.getContextPath()%>/<fmt:message key='CommonImagePath' />table_1_02.gif" 
            width="30" /></td>
                <td align="left" width="200" 
            background="<%=request.getContextPath()%>/<fmt:message key='CommonImagePath' />table_1_03.gif">&nbsp;<b>增 加 教 师</b></td>
                <td width="59"><img height="38" alt="" src="<%=request.getContextPath()%>/<fmt:message key='CommonImagePath' />table_1_04.gif" 
            width="59" /></td>
                <td>&nbsp;</td>
              </tr>
            </tbody>
        </table></td>
        <td width="8"><img height="38" alt="" src="<%=request.getContextPath()%>/<fmt:message key='CommonImagePath' />table_1_06.gif" 
      width="8" /></td>
      </tr>
      <tr>
        <td background="<%=request.getContextPath()%>/<fmt:message key='CommonImagePath' />table_1_07.gif"><img height="1" 
      src="<%=request.getContextPath()%>/<fmt:message key='CommonImagePath' />spacer.gif" width="1" /></td>
        <td bgcolor="#f7fbff"><table cellspacing="0" bordercolordark="#ccccff" cellpadding="0" width="100%" bordercolorlight="#ffffff" border="0">
            <tbody>
              <tr bgcolor="#a4c9ec">
                <td align="middle"><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#a4c9ec" class="fontbot">
                    <tr>
                      <td width="20%" height="20" align="right" valign="middle" bgcolor="#e6f0f8">教师姓名：</td>
                      <td height="20" align="left" valign="middle" bgcolor="#FFFFFF"><input name="tname" type="text" class="boxcopy2" id="textfield10"  style="width:100px;"  maxlength="10" />
                        <span class="STYLE4">*</span></td>
                    </tr>
                </table></td>
              </tr>
              <tr bgcolor="#ffffff">
                <td><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#a4c9ec" class="fontbot">
                    <tr>
                      <td width="20%" height="20" align="right" valign="middle" bgcolor="#e6f0f8">性 别：</td>
                      <td height="20" align="left" valign="middle" bgcolor="#FFFFFF"><input type="radio" name="sex" id="radio" value="男" checked/>
                        男
                        <input type="radio" name="sex" id="radio2" value="女" />
                        女</td>
                    </tr>
                </table></td>
              </tr>
              <tr bgcolor="#ffffff">
                <td><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#a4c9ec" class="fontbot">
                    <tr>
                      <td width="20%" height="20" align="right" valign="middle" bgcolor="#e6f0f8">出生日期：</td>
                      <td height="20" align="left" valign="middle" bgcolor="#FFFFFF">
                        <input name="tbirthday" type="text"  id="textfield18" 
						class="Wdate" onClick="SelectDate(this,'yyyy-MM-dd')"  style="width:100px;" maxlength="4"  readOnly="true" />
                    <span class="STYLE4">*</span></td>
                    </tr>
                </table></td>
              </tr>
              <tr bgcolor="#ffffff">
                <td><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#a4c9ec" class="fontbot">
                    <tr>
                      <td width="20%" height="20" align="right" valign="middle" bgcolor="#e6f0f8">工作时间：</td>
                      <td height="20" align="left" valign="middle" bgcolor="#FFFFFF">
                       <input name="workTime" type="text" class="boxcopy2" id="textfield22"  style="width:100px;"  dataType="Integer" msg="必须是整数" value="<bean:write name="teacherForm" property="workTime" />"/>
                         年 <span class="STYLE4">*</span>(必须是正整数,如:1或者12) </td>
                    </tr>
                </table></td>
              </tr>
              <tr bgcolor="#ffffff">
                <td><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#a4c9ec" class="fontbot">
                    <tr>
                      <td width="20%" height="20" align="right" valign="middle" bgcolor="#e6f0f8">学 历：</td>
                      <td height="20" align="left" valign="middle" bgcolor="#FFFFFF">
                 <select name="xueLi" class="boxcopy2"  style="width:104px;">
                  <option <logic:equal name="teacherForm" property="xueLi" value="大专"> selected </logic:equal>>大专</option>
                  <option <logic:equal name="teacherForm" property="xueLi" value="大学"> selected </logic:equal>>大学</option>
                  <option <logic:equal name="teacherForm" property="xueLi" value="硕士"> selected </logic:equal>>硕士</option>
                  <option <logic:equal name="teacherForm" property="xueLi" value="博士"> selected </logic:equal>>博士</option>
                </select>
                      </td>
                    </tr>
                </table></td>
              </tr>
              <tr bgcolor="#ffffff">
                <td><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#a4c9ec" class="fontbot">
                    <tr>
                      <td width="20%" height="20" align="right" valign="middle" bgcolor="#e6f0f8">职 称：</td>
                      <td height="20" align="left" valign="middle" bgcolor="#FFFFFF"><input name="position" type="text" class="boxcopy2" id="textfield"  style="width:100px;" maxlength="40"  value="<bean:write name="teacherForm" property="position" />"/></td>
                    </tr>
                </table></td>
              </tr>

              <tr bgcolor="#ffffff">
                <td><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#a4c9ec" class="fontbot">
                    <tr>
                      <td width="20%" height="20" align="right" valign="middle" bgcolor="#e6f0f8">专业方向：</td>
                      <td height="20" align="left" valign="middle" bgcolor="#FFFFFF"><input name="specDirect" type="text" class="boxcopy2" id="textfield2"  style="width:100px;"  maxlength="90" value="<bean:write name="teacherForm" property="specDirect" />"/></td>
                    </tr>
                </table></td>
              </tr>
              <tr bgcolor="#ffffff">
                <td><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#a4c9ec" class="fontbot">
                    <tr>
                      <td width="20%" height="20" align="right" valign="middle" bgcolor="#e6f0f8">专业特长：</td>
                      <td height="20" align="left" valign="middle" bgcolor="#FFFFFF"><input name="special" type="text" class="boxcopy2" id="textfield7"  style="width:100px;" maxlength="90"  value="<bean:write name="teacherForm" property="special" />"/></td>
                    </tr>
                </table></td>
              </tr>
              <tr bgcolor="#ffffff">
                <td><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#a4c9ec" class="fontbot">
                    <tr>
                      <td width="20%" height="20" align="right" valign="middle" bgcolor="#e6f0f8">教学经历：</td>
                      <td height="20" align="left" valign="middle" bgcolor="#FFFFFF">
                      <textarea name="teachProcess" rows="5" class="boxcopy2" id="teachProcess" style="width:300px;"  onpropertychange="if(value.length>125) value=value.substr(0,125)"></textarea>
                      (200字以内)</td>
                    </tr>
                </table></td>
              </tr>
              <tr bgcolor="#ffffff">
                <td><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#a4c9ec" class="fontbot">
                    <tr>
                      <td width="20%" height="20" align="right" valign="middle" bgcolor="#e6f0f8">曾获荣誉：</td>
                      <td height="20" align="left" valign="middle" bgcolor="#FFFFFF">
                      <textarea name="rongYu" rows="5" class="boxcopy2" id="rongYu" style="width:300px;" onpropertychange="if(value.length>125) value=value.substr(0,125)"></textarea>
                      (200字以内)</td>
                    </tr>
                </table></td>
              </tr>
              <tr bgcolor="#ffffff">
                <td bgcolor="#ffffff"><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#a4c9ec" class="fontbot">
                  <tr>
                    <td width="20%" height="20" align="right" valign="middle" bgcolor="#e6f0f8">分工类别：</td>
                    <td height="20" align="left" valign="middle" bgcolor="#FFFFFF">
                    <html:select name="teacherForm" property="fengongType"  styleClass="boxcopy2"  style="width:104px;">
                  <html:optionsCollection name="list" label="name" value="id"/>
                  </html:select>
                    
                    </td>
                  </tr>
                </table></td>
              </tr>
              <tr bgcolor="#ffffff">
                <td><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#a4c9ec" class="fontbot">
                  <tr>
                    <td width="20%" height="20" align="right" valign="middle" bgcolor="#e6f0f8">责任类别：</td>
                    <td height="20" align="left" valign="middle" bgcolor="#FFFFFF">
                  <select name="zeRenType" class="boxcopy2"  style="width:104px;">
                  <%-- <option <logic:equal name="teacherForm" property="zeRenType" value="校长(主任)"> selected </logic:equal>>校长(主任)</option>
                  <option <logic:equal name="teacherForm" property="zeRenType" value="副校长(副主任)"> selected </logic:equal>>副校长(副主任)</option>
                  <option <logic:equal name="teacherForm" property="zeRenType" value="校长(主任)助理"> selected </logic:equal>>校长(主任)助理</option>
                  <option <logic:equal name="teacherForm" property="zeRenType" value="年级组长"> selected </logic:equal>>年级组长</option>
                  <option <logic:equal name="teacherForm" property="zeRenType" value="班主任"> selected </logic:equal>>班主任</option>
                  <option <logic:equal name="teacherForm" property="zeRenType" value="普通教师"> selected </logic:equal>>普通教师</option>--%>
						 <%
							Map<String,String> mapping = Teacher.dutyMapping;
							for(String s : mapping.keySet()){
						%>
							<option value="<%=s %>" ><%=mapping.get(s) %></option>
						<%
							}
						%>
                            
                                </select>
                    </td>
                  </tr>
                </table></td>
              </tr>
              <tr bgcolor="#ffffff">
                <td><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#a4c9ec" class="fontbot">
                  <tr>
                    <td width="20%" height="20" align="right" valign="middle" bgcolor="#e6f0f8">用户名：</td>
                    <td height="20" align="left" valign="middle" bgcolor="#FFFFFF">
						<input name="tuserName" type="text" class="boxcopy2" id="textfield4"  style="width:100px;" onblur="checkUserName(this);" maxlength="10" dataType="Require" msg="用户名必须填写" value="<bean:write name="teacherForm" property="tuserName" />" />
						 <span class="STYLE4" id="userNameSpan">*</span>
                    (只允许是4-10位的字母,数字！)
                    </td>
                  </tr>
                </table></td>
              </tr>
              <tr bgcolor="#ffffff">
                <td><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#a4c9ec" class="fontbot">
                  <tr>
                    <td width="20%" height="20" align="right" valign="middle" bgcolor="#e6f0f8">登录密码：</td>
                    <td height="20" align="left" valign="middle" bgcolor="#FFFFFF">
                    <input type=password name="tpassWord" Class="boxcopy2" style="width:100px;"  maxlength="15" /> <span class="STYLE4">*</span>
                    (只允许4-15位的字母，数字或下划线)
                    </td>
                  </tr>
                </table></td>
              </tr>
              <tr bgcolor="#ffffff">
                <td><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#a4c9ec" class="fontbot">
                  <tr>
                    <td width="20%" height="20" align="right" valign="middle" bgcolor="#e6f0f8">确认密码：</td>
                    <td height="20" align="left" valign="middle" bgcolor="#FFFFFF">
                    <input type=password name="cpassWord" Class="boxcopy2" style="width:100px;"  maxlength="15" /> <span class="STYLE4">*</span>
                    (只允许4-15位的字母，数字或下划线)
                    </td>
                  </tr>
                </table></td>
              </tr>
            </tbody>
          </table>
            <table cellspacing="1" cellpadding="0" width="100%" bgcolor="#ffffff" 
        border="0">
              <tbody>
                <tr>
                  <td align="middle" bgcolor="#e6f0f8"><table cellspacing="0" cellpadding="3" width="100%" border="0">
                      <tbody>
                        <tr>
                          <td width="50%" align="right"><input type="image" src="<%=request.getContextPath()%>/<fmt:message key='CommonImagePath' />gif-01.gif" width="53" height="22" border="0" /></td>
                          <td width="50%" align="left"><a href="javascript:document.forms[0].reset();" onfocus="this.blur()"><img src="<%=request.getContextPath()%>/<fmt:message key='CommonImagePath' />gif-02.gif" width="53" height="22" border="0" /></a></td>
                        </tr>
                      </tbody>
                  </table></td>
                </tr>
              </tbody>
          </table></td>
        <td background="<%=request.getContextPath()%>/<fmt:message key='CommonImagePath' />table_1_09.gif"><img height="1" 
      src="<%=request.getContextPath()%>/<fmt:message key='CommonImagePath' />spacer.gif" width="1" /></td>
      </tr>
      <tr>
        <td><img height="22" alt="" src="<%=request.getContextPath()%>/<fmt:message key='CommonImagePath' />table_1_10.gif" width="7" /></td>
        <td background="<%=request.getContextPath()%>/<fmt:message key='CommonImagePath' />table_1_11.gif">&nbsp;</td>
        <td><img height="22" alt="" src="<%=request.getContextPath()%>/<fmt:message key='CommonImagePath' />table_1_12.gif" 
  width="8" /></td>
      </tr>
    </tbody>
  </table>
</form>
</body>
</html>
 